VERSION 5.00
Begin VB.Form Form1 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Comic Reader"
   ClientHeight    =   10335
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   6240
   Icon            =   "Form1.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   689
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   416
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton Command5 
      Caption         =   "<<"
      Height          =   255
      Left            =   120
      TabIndex        =   9
      ToolTipText     =   "Tap sau"
      Top             =   480
      Width           =   495
   End
   Begin VB.CommandButton Command4 
      Caption         =   ">>"
      Height          =   255
      Left            =   1920
      TabIndex        =   8
      ToolTipText     =   "Tap truoc"
      Top             =   480
      Width           =   495
   End
   Begin VB.CommandButton Command3 
      Caption         =   "Go!"
      Height          =   255
      Left            =   5160
      TabIndex        =   7
      Top             =   120
      Width           =   975
   End
   Begin VB.CheckBox Check1 
      Caption         =   "2 Page View"
      Height          =   255
      Left            =   2520
      TabIndex        =   6
      Top             =   480
      Width           =   3615
   End
   Begin VB.TextBox Text1 
      Height          =   285
      Left            =   720
      TabIndex        =   5
      Text            =   "Naruto"
      Top             =   120
      Width           =   4335
   End
   Begin VB.PictureBox Picture2 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      ForeColor       =   &H80000008&
      Height          =   9375
      Left            =   6240
      ScaleHeight     =   9345
      ScaleWidth      =   5970
      TabIndex        =   4
      Top             =   840
      Width           =   6000
   End
   Begin VB.CommandButton Command2 
      Caption         =   "=>"
      Height          =   255
      Left            =   1320
      TabIndex        =   2
      ToolTipText     =   "Trang sau"
      Top             =   480
      Width           =   495
   End
   Begin VB.CommandButton Command1 
      Caption         =   "<="
      Height          =   255
      Left            =   720
      TabIndex        =   1
      ToolTipText     =   "Trang truoc"
      Top             =   480
      Width           =   495
   End
   Begin VB.PictureBox Picture1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      ForeColor       =   &H80000008&
      Height          =   9375
      Left            =   120
      ScaleHeight     =   9345
      ScaleWidth      =   5970
      TabIndex        =   0
      Top             =   840
      Width           =   6000
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "Name:"
      Height          =   255
      Left            =   120
      TabIndex        =   3
      Top             =   150
      Width           =   615
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function URLDownloadToFile Lib "urlmon" _
    Alias "URLDownloadToFileA" (ByVal pCaller As Long, _
    ByVal szURL As String, ByVal szFileName As String, _
    ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long

Dim sLink As String
Dim sLink2 As String
Dim cName As String
Dim tap As Integer
Dim trang As Integer
Dim sD As String
Dim img As IPictureDisp
Dim img2 As IPictureDisp
Dim p2v As Boolean

Private Sub Check1_Click()
If Check1.Value = False Then
    Me.Width = 6330
    Picture2.Visible = False
    p2v = False
Else
    Me.Width = 12450
    Picture2.Visible = True
    p2v = True
End If
OpenPage
End Sub

Public Sub OpenPage()
cName = Text1.Text
If p2v = False Then
    If trang = 0 Then
        sD = "bia"
        sLink = "http://data.vuilen.com/comic/3zdssxfhxjgiu87z65txdfghyux761xx/" + cName + "/tap" + CStr(tap) + "/img/" + sD + ".jpg"
    Else
        sD = "Untitled-"
        sLink = "http://data.vuilen.com/comic/3zdssxfhxjgiu87z65txdfghyux761xx/" + cName + "/tap" + CStr(tap) + "/img/" + sD + CStr(trang) + ".jpg"
    End If
    DoEvents
    Me.Caption = "Comic Reader - Downloading..."
    URLDownloadToFile 0, sLink, Environ("WinDir") + "\Temp\comic.jpg", 0, 0
    Set img = LoadPicture(Environ("WinDir") + "\Temp\comic.jpg")
    Picture1.Picture = img
    Me.Caption = "Comic Reader"
Else
    If trang = 0 Then
        sD = "bia"
        sLink = "http://data.vuilen.com/comic/3zdssxfhxjgiu87z65txdfghyux761xx/" + cName + "/tap" + CStr(tap) + "/img/" + sD + ".jpg"
        sLink2 = "http://data.vuilen.com/comic/3zdssxfhxjgiu87z65txdfghyux761xx/" + cName + "/tap" + CStr(tap) + "/img/Untitled-1.jpg"
    Else
        sD = "Untitled-"
        sLink = "http://data.vuilen.com/comic/3zdssxfhxjgiu87z65txdfghyux761xx/" + cName + "/tap" + CStr(tap) + "/img/" + sD + CStr(trang) + ".jpg"
        sLink2 = "http://data.vuilen.com/comic/3zdssxfhxjgiu87z65txdfghyux761xx/" + cName + "/tap" + CStr(tap) + "/img/" + sD + CStr(trang + 1) + ".jpg"
    End If
    DoEvents
    Me.Caption = "Comic Reader - Downloading page 1..."
    URLDownloadToFile 0, sLink, Environ("WinDir") + "\Temp\comic.jpg", 0, 0
    Set img = LoadPicture(Environ("WinDir") + "\Temp\comic.jpg")
    Picture1.Picture = img
    Me.Caption = "Comic Reader - Downloading page 2..."
    URLDownloadToFile 0, sLink2, Environ("WinDir") + "\Temp\comic2.jpg", 0, 0
    Set img2 = LoadPicture(Environ("WinDir") + "\Temp\comic2.jpg")
    Picture2.Picture = img2
    trang = trang + 1
    Me.Caption = "Comic Reader"
End If
End Sub

Private Sub Command1_Click()
trang = trang - 1
OpenPage
End Sub

Private Sub Command2_Click()
trang = trang + 1
OpenPage
End Sub

Private Sub Command3_Click()
OpenPage
End Sub

Private Sub Command4_Click()
tap = tap + 1
OpenPage
End Sub

Private Sub Command5_Click()
If tap > 1 Then
tap = tap - 1
OpenPage
End If
End Sub

Private Sub Form_Load()
p2v = False
tap = 1
trang = 0
cName = Text1.Text
OpenPage
End Sub
